﻿<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:Common="clr-namespace:Informant.UI;assembly=Informant.UI"
             xmlns:Controls="clr-namespace:Informant.UI.Wpf.Controls"
             xmlns:Utilities="clr-namespace:Informant.UI.Wpf.Utilities"
             xmlns:ViewModels="clr-namespace:Informant.UI.ViewModels;assembly=Informant.UI.ViewModels"
             xmlns:UI="clr-namespace:Informant.UI;assembly=Informant.UI"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             x:Class="Informant.UI.Wpf.LogOnView"
             mc:Ignorable="d"
             d:DesignWidth="416"
             d:DesignHeight="478">
    <UserControl.DataContext>
        <ViewModels:LogOnViewModel />
    </UserControl.DataContext>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <Border HorizontalAlignment="Center"
                Grid.Row="1"
                Padding="35,15"
                Background="#B2000000"
                CornerRadius="5"
                Margin="0"
                d:LayoutOverrides="Height"
                VerticalAlignment="Center">
            <StackPanel Orientation="Vertical"
                        d:LayoutOverrides="Height"
                        VerticalAlignment="Top"
                        HorizontalAlignment="Center">
                <TextBlock HorizontalAlignment="Center"
                           Text="Login to Google Voice"
                           TextWrapping="Wrap"
                           FontSize="18.667"
                           Foreground="{DynamicResource INFForegroundColor}" />
                <StackPanel HorizontalAlignment="Center"
                            VerticalAlignment="Top"
                            Margin="0,10,0,0">
                    <DockPanel HorizontalAlignment="Right"
                               FocusManager.FocusedElement="{Binding ElementName=Username}">
                        <TextBlock HorizontalAlignment="Right"
                                   Text="Username:"
                                   VerticalAlignment="Center"
                                   Foreground="{DynamicResource INFForegroundColor}"
                                   FontSize="16" />
                        <TextBox x:Name="Username"
                                 Text="{Binding Username}"
                                 Utilities:TextBoxHelper.UpdateBindingOnTextChanged="True"
                                 IsEnabled="{Binding IsLogOnInProgress, Converter={StaticResource InverseBooleanConverter}}"
                                 Margin="20,0,0,0"
                                 Width="200"
                                 DockPanel.Dock="Right"
                                 Height="30"
                                 VerticalContentAlignment="Center"
                                 HorizontalScrollBarVisibility="Disabled" />
                    </DockPanel>
                    <DockPanel HorizontalAlignment="Right"
                               Margin="0,5,0,0">
                        <TextBlock HorizontalAlignment="Right"
                                   Text="Password:"
                                   VerticalAlignment="Center"
                                   Foreground="{DynamicResource INFForegroundColor}"
                                   FontSize="16" />
                        <PasswordBox x:Name="Password"
                                     Utilities:PasswordHelper.Attach="True"
                                     Utilities:PasswordHelper.Password="{Binding Password, Mode=TwoWay}"
                                     IsEnabled="{Binding IsLogOnInProgress, Converter={StaticResource InverseBooleanConverter}}"
                                     Width="200"
                                     Margin="20,0,0,0"
                                     DockPanel.Dock="Right"
                                     Height="30"
                                     VerticalContentAlignment="Center" />
                    </DockPanel>
					<CheckBox Content="Remember Credentials"
							  IsChecked="{Binding RememberCredentials}"
							  VerticalAlignment="Center"
							  HorizontalAlignment="Right"
							  Foreground="{DynamicResource INFForegroundColor}"
							  FontSize="16" />
					<TextBlock Text="{Binding LogOnFailureMessage}"
                               TextWrapping="Wrap"
                               Foreground="White"
                               HorizontalAlignment="Right"
                               VerticalAlignment="Top"
                               Visibility="{Binding LogOnFailed, Converter={StaticResource BooleanToVisibilityConverter}}"
                               Margin="0,5,0,0" />
                    <DockPanel Margin="0,8,0,0">
                        <Button x:Name="LogOn"
                                DockPanel.Dock="Right"
                                IsDefault="True"
                                HorizontalAlignment="Right"
                                Content="Log On"
                                Command="{Binding LogOn}"
                                Width="100"
                                Height="30" />
                        <StackPanel Height="30"
                                    Orientation="Horizontal"
                                    HorizontalAlignment="Left"
                                    Visibility="{Binding IsLogOnInProgress, Converter={StaticResource BooleanToVisibilityConverter}}">
                            <TextBlock VerticalAlignment="Center"
                                       FontSize="16"
                                       Foreground="White"
                                       Text="Processing..."
                                       Margin="0,0,9,0" />
                            <Controls:WaitCursor x:Name="WaitCursor"
                                                 IsActive="{Binding IsLogOnInProgress}"
                                                 Width="30" />
                        </StackPanel>
                    </DockPanel>
                </StackPanel>
            </StackPanel>
        </Border>
    </Grid>
</UserControl>